﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wasion.HHU.Services
{
    public class PtlBaseUIProConsts
    {
        public delegate void EventAfterSave();  //保存表之后的操作委托
        public delegate void EventAfterSelect(PtlBaseMeter ameter, bool bcheck);  //选表之后的操作委托
        public static string LanType = "en";        //语言种类
        //public static EasyDb easyDb = null;  //连接系统数据库
        public static PtlType ptltype = PtlType.IEC62056;  //当前协议
        public static string PtlDabatase = "";  //本地协议库名称
        public static bool IsRunning = false;   //是否正在执行通信过程

        #region 协议数据库连接
        //public static IDbConnection ptlConn = null;
        //public static EasyDatabaseType ptldbtype = new EasyDatabaseType();
        //public static EasyDb ptlDb = null;
        #endregion

        #region 协议升级库连接
        //public static EasyDb ptlUpdateDb = null;
        #endregion


        public static string MainDir = string.Empty;   //主路径
        public const string LocalPtlDir = "LocalPtl";  //存储各地方协议库的文件夹
        public const string iniFileName = "Parameter.ini";  //配置文件名
        public static bool AdminCome = false;   //当前登录用户是否为超级管理员
        public static string NowOid = string.Empty;  //当前用户ID
        public static string NowUserName = string.Empty;  //当前用户名
        public static string NowUserNo = string.Empty;   //当前用户标识
        public static int MaxMeter = 3;  //最大表位数
        public const string SchemaDir = "Schema";  //保存导出方案的文件夹

        #region 未注册试用相关
        public static string RegPath = string.Empty;  //注册信息文件路径
        public const string RegCheckFile = "wsconfig.dll";  //注册信息文件名
        public static string RegTime = string.Empty; //第一次试用时间
        public static string LastRunIime = string.Empty;  //上次试用时间
        public static int RunningTime = 0;  //当前使用时长(秒)
        //public static TimerObj TimerRun = new TimerObj();
        #endregion


        public static CommConst.EventChangeStatus ShowComminfo = null;  //通信指令状态改变时界面显示收发帧
        public static CommConst.EventAnalysis doAnalysis = null;  //收到返回帧后的解析事件

        //表计控制类
        public static EventAfterSelect DoAfterSelectMeterMain = null;  //主界面响应选表后的操作
        public static EventAfterSave DoAfterSaveMeterMain = null;  //主界面响应保存表后的操作

        public static int UIHandle = 0;  //主窗体句柄 hxh 2019-4-28
        public static bool CanUpdate = true;  //是否可以检测到更新

        public static string GroupAdmin = string.Empty;
    }

    public enum PtlType
    {
        DLT698_45 = 1,
        IEC62056 = 2,
        ANSI = 3, //hxh
        DLT645_07 = 4,
        IEC1107 = 5
    };  //协议类别
}
